<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Vue component 组件</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <script type="text/javascript" src="../assets/js/vue.js"></script>
</head>

<body>
    <h1>Vue component 组件</h1>
    <a href="../index.html">返回</a>
    <hr />
    <div id="app">
        {{message}}
        <myinfo></myinfo>
        <prolist></prolist>
        <prolist></prolist>
    </div>

    <div id="app2">
        <myinfo></myinfo>
    </div>
    <script>
        Vue.component('myinfo', {
            template: `<div style="border:solid 1px"><h3>我叫李永耀</h3><p>性别：男</p><p>年龄:29</p>
                <p>这是一个全局组件，用的是Vue.component;可以在其他 vue中使用</p>
                </div>`
        })

        var app = new Vue({
            el: "#app",
            data: {
                message: "hello world"
            },
            components: {
                "prolist": {
                    template: `<div style="border:solid 1px #00ff00">
                        <h3>产品信息</h3>
                        <p>这是一个局部组件，用的是components</p>
                        </div>`
                }
            }
        });
        var app2 = new Vue({
            el: "#app2"
        })
    </script>
</body>

</html>